
************************************************************************************************************************************************
****************************** REPLICATION CODE: RELIGION AND BRAZILIAN POLITICS 
****************************** 2019. Cambridge University Press
****************************** By Amy Erica Smith (amyericas@gmail.com) 

****************************** ANALYSIS OF CHURCHES NORTH AND SOUTH CLERGY SURVEY



****************************************** VARIABLE CODING **************************************************************************************
****** The analysis uses the clergy survey from the Churches North and South project, conducted Fall 2014 by Amy Erica Smith

use "ChurchesNorthAndSouth_Brazil2014_Clergy.dta", clear

sencode city, replace
g juiz = city == 2
g conference = city == 1

g idnum = city*10000+qnrnum1


replace p35_clergyviewdiff_nbhd = "." if p35_clergyviewdiff_nbhd == "Don't Know" | p35_clergyviewdiff_nbhd == "Don't know" 
replace p33_samediffcand = "." if p33_samediffcand == "Don't know" 
destring p35_clergyviewdiff_nbhd, replace
destring p33_samediffcand, replace

********** TREATMENT/VERSION VARIABLES
g treat = 1 if version == "A" 
	replace treat = 2 if version == "B" 
	replace treat = 3 if version == "C"
tab1 version, g(version)
	rename version1 versionA
	rename version2 versionB
	rename version3 versionC
	
********* PERSONAL DEMOGRAPHICS
destring p3_, replace
g female = (sex == "F")
	replace female = 0 if sex == "M"
recode p3_yearsworking (300=30) (400=40) (450=45)
	egen tenure = cut(p3_yearsworking), group(10)
	replace tenure = tenure/9
recode tenure (. = .52) if versionC == 0


****** DENOMINATION
g evanpent = (p1_denomination > 1)
	lab def evanpent 0 "Catholic" 1 "Evangelical/Pentecostal"
	lab val evanpent evanpent
g catholic = (p1_denomination == 1)

recode p1_denomination (1=1) (2 3 5 6 = 2) (4 = 3) , g(denom)
lab def denom 1 "Catholic" 2 "Evangelical/Mainline" 3 "Pentecostal"
lab val denom denom

egen denomXcity = group(denom city)
	lab def denomXcity 1 "JF Catholic" 2 "RJ Catholic" 3 "Conf Evan" 4 "JF Evan" 5 "RJ Evan" 6 "Conf Pent" 7 "JF Pent" 8 "RJ Pent"
	lab val denomXcity denomXcity

destring p4_weeklyattend, replace
tab1 p5_weeklyattend_chg p6_invitation p7_worryotherchurches
recode p5_weeklyattend_chg (1=1) (2=0) (3 . =.5), g(attendance)
g attendstagnant = (p5_weeklyattend_chg != 1)
g attendrise = (p5_weeklyattend_chg == 1)
egen weeklyattend = cut(p4_weeklyattend), group(10)
recode weeklyattend (0/5=1) (6=2) (7=3) (8=4) (9=5), g(weeklyattend_cath)
	lab def weeklyattend_cath 1 "<395" 2 "400-595" 3 "600-845" 4 "850-1700" 5 "1800+"
	lab val weeklyattend_cath weeklyattend_cath
replace weeklyattend=weeklyattend/9
	
recode p6_ (1=1) (2/. = 0) if versionC != 1, g(outreach)

g logattendance = log(p4_weeklyattend)
reg logattendance i.denom

recode p7_worryotherchurches 5=.
replace p7_worryotherchurches = (3-p7_worryotherchurches)/2
recode p7_worry (0 = 0) (.5 1 = 1), g(worrydummy)
g noworry = 1-worrydummy

alpha attendrise outreach noworry, item
egen growthoriented = rowmean(attendrise outreach)
	recode growthoriented (.5=0)

**** GRIEVANCES and the fairness of laws
recode p36_favorgroup (2=1) (1 3 =0), g(grievancelaws2)
recode p37_favorgroup (2=1) (1 3 =0) (4 5 6 = .), g(grievancepres2)
egen grievances2 = rowmean(grievancelaws2 grievancepres2)
recode grievances2 (.5 1 = 1), g(grievances)

recode p37_favorgroup  (4 5 6 = 3)
recode p36_favorgroup (3=1) (1 2 =0), g(neutrallaws)
recode p37_favorgroup (3=1) (1 2 =0), g(neutralpres)
egen stateneutrality = rowmean(neutrallaws neutralpres)
recode stateneutrality (0/.5=0), g(stateneutrality2)

recode p36_favorgroup (1=1) (2 3 =0), g(favoredlaws)
recode p37_favorgroup (1=1) (2 3 =0) (4 5 6 = .), g(favoredpres)
egen favored = rowmean(favoredlaws favoredpres)
recode favored (.5 = 1), g(favored2)

g fairness = stateneutrality-grievances2
egen neutrality = group(neutrallaws neutralpres)
tab neutrality neutrallaws
lab def neutrality 1 "Neither" 2 "Pres but not laws" 3 "Laws but not pres" 4 "Both neutral"
lab val neutrality neutrality

g class = (5-p2_socialclass)/4
recode class (0/.25 = 1) (.5/. = 0), g(lowerclass)
recode class (1 = 1) (0/.75 . = 0), g(upperclass)

********************** RECODING 4-POINT and 3-point VARIABLES ON 0 TO 1 SCALE
forvalues i = 8/27 {
	replace p`i'_ = (p`i'_-1)/4
}
forvalues i = 38/39 {
	replace p`i'_ = (p`i'_-1)/4
}
recode  p28_campn_members 5 = .
foreach i in 28 29 30 31 34 35 {
	replace p`i'_ = (p`i'_-1)/3
}
replace p34_clergyviewdiff_church = 1-p34_clergyviewdiff_church 
replace p35_clergyviewdiff_nbhd = 1-p35_clergyviewdiff_nbhd

***** MEASURES OF DOCTRINAL CONSERVATISM and other theological positions
factor p13_discuss_evangelism p15_discuss_godswrath p16_discuss_endtimes p20_discuss_avoidsin
alpha p13_discuss_evangelism p15_discuss_godswrath p16_discuss_endtimes p20_discuss_avoidsin
	
****** political activities
alpha p8_role_socialmovements p29_campn_encourageturnout p30_campn_faithvote p31_campn_leaders p11_role_supportlaws, item
egen activismindex = rowmean(p8_role_socialmovements p29_campn_encourageturnout p30_campn_faithvote p31_campn_leaders p11_role_supportlaws)
egen electoralactivism = rowmean(p29_campn_encourageturnout p30_campn_faithvote p31_campn_leaders)

****** PUBLIC ISSUES
summ p21_discuss_traditionalfamily p23_discuss_homosexuality p24_discuss_abortion
alpha p21_discuss_traditionalfamily p23_discuss_homosexuality p24_discuss_abortion, item
egen sex_family = rowmean(p21_discuss_traditionalfamily p23_discuss_homosexuality p24_discuss_abortion)

***** SIMILARITY TO CHURCH/NEIGHBORHOOD; DIVERSITY WITHIN CHURCH
recode p33_samediffcand (1=0) (2 3 = 1) (4 = .)
egen difference = rowmean(p34_ p33_)

global conservativeteachings p15_discuss_godswrath p16_discuss_endtimes p20_discuss_avoidsin ///
		p21_discuss_traditionalfamily p22_discuss_chastity p23_discuss_homosexuality p24_discuss_abortion 
factor $conservativeteachings if catholic == 1
factor $conservativeteachings if evanpent == 1
factor $conservativeteachings 
alpha $conservativeteachings , item
egen conservatism = rowmean($conservativeteachings)
	summ conservatism 
	replace conservatism = (conservatism-r(min))/(r(max)-r(min))

	
******************************* BALANCE STATISTICS

foreach var in female tenure weeklyattend class evanpent juiz {
	mean(`var'), over(versionA)
	mean(`var'), over(versionC)
}	
	
recode p8_ (0/.8 = 0) (1 = 1), g(p8d)
recode p11_ (0/.8 = 0), g(p11d)
recode p29_ (0/.5 = 0) (.6/1 = 1), g(p29d) 
recode p30_ (0/.5 = 0) (.6/1 = 1), g(p30d)
recode p31_ (0 = 0) (.2/1=1), g(p31d)


************************************************************************************************************************************************
************************************************************************************************************************************************
****************************************** ANALYSIS ********************************************************************************************


************ TABLE 3.1. CLERGY STUDY SAMPLE CHARACTERISTICS
tab1 denom
tab city denom if versionC == 0
tab denom if versionC == 1
tab female denom, col
tabstat p3_yearsworking p4_weeklyattend, by(denom) statistics(median)
************ END TABLE 3.1. CLERGY STUDY SAMPLE CHARACTERISTICS


************ FIGURE 3.1. Membership Change and Recruitment Efforts
preserve
recode attendstagnant outreach worrydummy (1=100)
collapse (mean) attendstagnant outreach worrydummy ///
	(semean) se_1=attendstagnant se_2=outreach se_3=worrydummy, by(denom)
drop if denom == .
set obs 11
egen denom2 = seq(), f(1) t(4) block(1)
	lab val denom2 denom
	drop denom
	rename denom2 denom
foreach i in attendstagnant outreach worrydummy se_1 se_2 se_3 {
	egen `i'mn = mean(`i'),by(denom)
	replace `i' = `i'mn
	drop `i'mn
}
g xaxis = _n
egen dv = seq(), f(1) t(3) block(4)
g dv_val = attendstagnant if dv == 1
	replace dv_val = outreach if dv == 2
	replace dv_val = worrydummy if dv == 3
g se_val = se_1 if dv == 1
	replace se_val = se_2 if dv == 2
	replace se_val = se_3 if dv == 3
g lb = dv_val-2*se_val
g ub = dv_val+2*se_val
graph twoway (bar dv_val xaxis if denom == 1, lcolor(black) fcolor(gs3)) || ///
			(bar dv_val xaxis if denom == 2, lcolor(black) fcolor(gs8)) || ///
			(bar dv_val xaxis if denom == 3, lcolor(black) fcolor(gs13)) || ///
			(rspike ub lb xaxis, lcolor(black)), ///
		legend(order(1 "Catholic" 2 "Evangelical" 3 "Pentecostal") cols(3) size(small)) ///
		xlabel(2 "Membership Stagnant/Dropping" 6 "Outreach Very Strong" 10 "Worried about Competition", notick) xtitle("") ylabel(0(20)80) ///
		ytitle("Percentage of Clergy Reporting", margin(small)) graphregion(fcolor(white) lcolor(black)) ///
		caption("Source: Churches North and South 2014, Clergy Study. Whiskers represent 95% confidence intervals." ///
		"Attendance change was asked of all respondents. Extent of outreach and worry about competition are" ///
		"limited to respondents to the full questionnaire.", span size(small))
restore
************ END FIGURE 3.1. Membership Change and Recruitment Efforts


************ FIGURE 4.1. CLERGY PRIORITIES, RANKED
preserve
collapse (mean) p17_discuss_hardwork p19_discuss_ministerpoor p21_discuss_traditionalfamily p22_discuss_chastity ///
		p23_discuss_homosexuality p24_discuss_abortion p25_discuss_environment p26_discuss_racism ///
	(semean) se_p17=p17_ se_p19=p19_ se_p21=p21_ se_p22=p22_ se_p23=p23_ se_p24=p24_ se_p25=p25_ se_p26=p26_ , by(denom)
drop if denom == .
set obs 26
egen denom2 = seq(), f(1) t(3) block(1)
sort denom2
foreach i in p17_discuss_hardwork p19_discuss_ministerpoor p21_discuss_traditionalfamily p22_discuss_chastity p23_discuss_homosexuality ///
		p24_discuss_abortion p25_discuss_environment p26_discuss_racism se_p17 se_p19 se_p21 se_p22 se_p23 se_p24 se_p25 se_p26 {
	egen `i'mn = mean(`i'), by(denom2)
	replace `i' = `i'mn
	drop `i'mn
}
egen dv = seq(), f(1) t(9) 
g dv_val = p17_ if dv == 1
	replace dv_val = p19_ if dv == 2
	replace dv_val = p21_ if dv == 3
	replace dv_val = p22_ if dv == 4
	replace dv_val = p23_ if dv == 5
	replace dv_val = p24_ if dv == 6
	replace dv_val = p25_ if dv == 7
	replace dv_val = p26_ if dv == 8
g se_val = se_p17 if dv == 1
	replace se_val = se_p19 if dv == 2
	replace se_val = se_p21 if dv == 3
	replace se_val = se_p22 if dv == 4
	replace se_val = se_p23 if dv == 5
	replace se_val = se_p24 if dv == 6
	replace se_val = se_p25 if dv == 7
	replace se_val = se_p26 if dv == 8
egen meansupport = mean(dv_val), by(denom2)
replace dv_val = dv_val-meansupport
	drop meansupport
g lb = dv_val-2*se_val
g ub = dv_val+2*se_val
sort denom2 dv_val
g xaxis = _n
graph twoway (scatter dv_val xaxis if dv == 1, mcolor(black) msymbol(X)) || ///
			(scatter dv_val xaxis if dv == 2, mcolor(black) msymbol(Th)) || ///
			(scatter dv_val xaxis if dv == 3, mcolor(black) msymbol(D)) || ///
			(scatter dv_val xaxis if dv == 4, mcolor(black) msymbol(T)) || ///
			(scatter dv_val xaxis if dv == 5, mcolor(black) msymbol(S)) || ///
			(scatter dv_val xaxis if dv == 6, mcolor(black) msymbol(Sh)) || ///
			(scatter dv_val xaxis if dv == 7, mcolor(black) msymbol(Oh)) || ///
			(scatter dv_val xaxis if dv == 8, mcolor(black) msymbol(o)) || ///
			(rspike ub lb xaxis, lcolor(black)), ///
		legend(order(5 "Homosexuality" "as Sin" 6 "Abortion" 4 "Chastity" 1 "Hard Work/" "Responsibility" 7 "Environment" ///
				3 "Traditional" "Family" 8 "Racism" 2 "Ministry to Poor") cols(4) size(small)) ///
		xlabel(4.5 "Catholic" 13.5 "Evangelical" 22.5 "Pentecostal", notick) xtitle("") ///
		ylabel(-.5(.25).25) yline(0, lcolor(gs10)) ytitle("Clergy Priorities in Discussion") graphregion(fcolor(white) lcolor(black)) ///
		caption("Source: Churches North and South 2014, Clergy Study. Whiskers represent 95% confidence intervals." ///
		"Frequency of speech on issue has been recentered around the mean within each denomination.", span size(small))
restore
************ END FIGURE 4.1. CLERGY PRIORITIES, RANKED


************ FIGURE 4.2. Impact of Competitive Threat on Issue Positions
tempfile tf1 tf2
global dvs p14_discuss_godslove p19_discuss_ministerpoor p18_discuss_prosperity p13_discuss_evangelism ///
			p17_discuss_hardwork p22_discuss_chastity p23_discuss_homosexuality p24_discuss_abortion p15_discuss_godswrath p16_discuss_endtimes 
foreach dv in  $dvs {
	reg `dv' versionA i.denomXcity if evanpent == 0
		parmest, label saving(`tf1', replace) level(90) 
	reg `dv' versionA i.denomXcity if evanpent == 1
		parmest, label saving(`tf2', replace) level(90) 
preserve
	dsconcat `tf1' 	`tf2'
	keep if parm == "versionA" 
	g dv = "`dv'"
	g group = _n
		lab def group 1 "Catholic" 2 "Evangelical/Pentecostal"
		lab val group group
	save `dv'.dta, replace
restore 
}
preserve
clear
append using $dvs 
sencode dv, replace
	lab def dv 1 "God's Love" 2 "Ministry to Poor" 3 "Prosperity Theology" 4 "Evangelism" ///
			5 "Hard Work/Responsibility" 6 "Chastity" 7 "Homosexuality" 8 "Abortion" 9 "God's Wrath" 10 "End Times", modify
	lab val dv dv
sort dv group  
egen yaxis = seq(), f(1) t(2)
graph twoway (bar estimate yaxis if group == 1, lcolor(black) fcolor(gs4) horizontal barwidth(.5)) ///
			(bar estimate yaxis if group == 2, lcolor(black) fcolor(gs12) horizontal barwidth(.5))  ///
			(rspike min90 max90 yaxis, lcolor(black) horizontal), ///
	by(dv, col(1) compact graphregion(fcolor(white) lcolor(black)) ///
		title("", size(medium) color(black) margin(medium)) ///
		note("Note: Bars represent marginal effects of the membership threat treatment on religious teachings." ///
			"Fixed effects for sample component. Sample limited to full questionnaire." ///
			"Source: Churches North and South 2014, Clergy Study." "Whiskers represent 95% confidence intervals.", span size(vsmall) margin(small)) ) ///
	subtitle(, ring(0) pos(1) justification(right) nobexpand lwidth(0) lcolor(gs10) fcolor(gs15) margin(small)) ///
	ylabel(none) ytitle("") legend(order(1 "Catholic" 2 "Evangelical/Pentecostal") symxsize(*.5) size(small) col(2)) ///
	ysize(8) xline(0, lcolor(gs5)) xlabel(-.4(.2).4, grid)
restore	
foreach dv in  $dvs {
	rm `dv'.dta
}
************ End FIGURE 4.2. Impact of Competitive Threat on Issue Positions


************ FIGURE 4.3. Grievances 
preserve
collapse (mean) grievances2 stateneutrality favored ///
	(semean) se_1=grievances2 se_2=stateneutrality se_3=favored , by(denom)
drop if denom == .
set obs 11
egen denom2 = seq(), f(1) t(4) block(1)
	lab val denom2 denom
	drop denom
	rename denom2 denom
foreach i in grievances2 stateneutrality favored se_1 se_2 se_3 {
	egen `i'mn = mean(`i'),by(denom)
	replace `i' = `i'mn
	drop `i'mn
}
g xaxis = _n
egen dv = seq(), f(1) t(3) block(4)
	lab def dv 1 "Mean Grievances" 2 "Mean Perceived State Neutrality" 3 "Mean Perceived Favoritism", modify
	lab val dv dv
g dv_val = grievances if dv == 1
	replace dv_val = stateneutrality if dv == 2
	replace dv_val = favored if dv == 3
g se_val = se_1 if dv == 1
	replace se_val = se_2 if dv == 2
	replace se_val = se_3 if dv == 3
g lb = dv_val-2*se_val
g ub = dv_val+2*se_val
graph twoway (bar dv_val xaxis if denom == 1, lcolor(black) fcolor(gs3)) || ///
			(bar dv_val xaxis if denom == 2, lcolor(black) fcolor(gs8)) || ///
			(bar dv_val xaxis if denom == 3, lcolor(black) fcolor(gs13)) || ///
			(rspike ub lb xaxis, lcolor(black)), ///
		legend(order(1 "Catholic" 2 "Evangelical" 3 "Pentecostal") cols(3) size(small)) xtitle("") ylabel(0(.25)1) ///
		xlabel(2 "Perceived State Harm" 6 "Perceived State Neutrality" 10 "Perceived State Favoritism", notick) ///
		graphregion(fcolor(white) lcolor(black)) ///
		caption("Source: Churches North and South 2014, Clergy Study. Whiskers represent 95% confidence intervals.", span size(small))
restore
************ End FIGURE 4.3. Grievances


************ FIGURE 4.4. Determinants of Grievances and Perceived Fairness
global indvars conservatism p14_discuss_godslove p19_discuss_ministerpoor p39_legit_democ p27_discuss_respectdifferences p10_role_givevoice ///
			growthoriented weeklyattend tenure female lowerclass  i.denom i.city 
global dvs grievances2 stateneutrality favored
foreach dv in  $dvs {
	ologit `dv' $indvars 
	parmest, idstr(`dv') saving(`dv', replace) level(90) 
}
preserve
clear
append using $dvs 
drop if parm == "1b.denom" | parm == "1b.city" | parm == "_cons"
rename idstr dv
sencode dv, replace
	lab def dv 1 "Perceived Hurt" 2 "Perceived Neutrality" 3 "Perceived Favoritism", modify
	lab val dv dv
g yorder = _n if _n <= 15
sencode parm, replace gsort(-yorder)
	drop yorder
lab def parm 15 "Conservatism" 14 "God's Love" 13 "Ministry to Poor" 12 "Legitimacy of Democracy" 11 "External Tolerance" 10 "Internal Tolerance" ///
	9 "Growth-Oriented" 8 "Weekly Attendance" 7 "Clergy Years in Congregation" 6 "Clergy Female" 5 "Lower Class Congregation" ///
	4 "Evangelical" 3 "Pentecostal" 2 "Juiz de Fora" 1 "Rio de Janeiro", modify
lab val parm parm
graph twoway (scatter parm estimate, mcolor(black)) ///
			(rspike min90 max90 parm, lcolor(black) horizontal), ///
	by(dv, col(3) graphregion(fcolor(white) lcolor(black)) xrescale ///
		note("Note: Coefficients and 90% confidence intervals from ordinal logistic regression models. Sample limited to full questionnaire.", ///
				span size(small)) legend(off) ) ///
	xtitle("") ytitle("") ylabel(1(1)15, valuelabel angle(horizontal)) ///
	subtitle(, lwidth(0) lcolor(white) fcolor(white) ) ///
	plotregion(lcolor(black)) xline(0, lcolor(gs13)) xsize(6.5)
restore	
foreach dv in  $dvs {
	rm `dv'.dta
}
************ End FIGURE 4.4. Determinants of Grievances and Perceived Fairness


************ FIGURE 5.1. CLERGY ELECTORAL PARTICIPATION BY RELIGIOUS AFFILIATION
preserve
recode p29_campn_encourageturnout p30_campn_faithvote p31_campn_leaders (0/.5 = 0) (.6/1 = 100)
global dvs p29_campn_encourageturnout p30_campn_faithvote p31_campn_leaders 
collapse (mean) $dvs ///
	(semean) se_1=p29_ se_2=p30_ se_3=p31_ , by(denom)
drop if denom == .
set obs 11
egen denom2 = seq(), f(1) t(4) block(1)
foreach i in $dvs se_1 se_2 se_3 {
	egen `i'mn = mean(`i'), by(denom2)
	replace `i' = `i'mn
	drop `i'mn
}
g xaxis = _n
egen dv = seq(), f(1) t(3) block(4)
g dv_val = p29_ if dv == 1
	replace dv_val = p30_ if dv == 2
	replace dv_val = p31_ if dv == 3
g se_val = se_1 if dv == 1
	replace se_val = se_2 if dv == 2
	replace se_val = se_3 if dv == 3
g lb = dv_val-2*se_val
g ub = dv_val+2*se_val
graph twoway (bar dv_val xaxis if denom2 == 1, lcolor(black) fcolor(gs3)) || ///
			(bar dv_val xaxis if denom2 == 2, lcolor(black) fcolor(gs8)) || ///
			(bar dv_val xaxis if denom2 == 3, lcolor(black) fcolor(gs13)) || ///
			(rspike ub lb xaxis, lcolor(black)), ///
		legend(order(1 "Catholic" 2 "Evangelical" 3 "Pentecostal") cols(3) size(small)) ///
		xlabel(2 "Encourage Turnout" 6 "Encourage Conscientious Vote" 10 "Support Candidate", notick) ///
		xtitle("") ylabel(0(20)100) ytitle("Percentage Saying Church Leaders Are Likely to:", margin(small)) ///
		graphregion(fcolor(white) lcolor(black)) ///
		caption("Source: Churches North and South 2014, Clergy Study. Whiskers represent 95% confidence intervals.", span size(small))
restore
************ END FIGURE 5.1. CLERGY ELECTORAL PARTICIPATION BY RELIGIOUS AFFILIATION


************ FIGURE 5.2. Impact of Membership Threat on Participation
global dvs p8d p11d p29d p30d p31d 
tempfile tf1 tf2
foreach dv in  $dvs {
preserve
	logit `dv' versionA if evanpent == 0 & versionC != 1
		margins, dydx(versionA) post
		parmest, label saving(`tf1', replace) idstr(`dv') level(90) 
restore
preserve
	logit `dv' versionA if evanpent == 1 & versionC != 1
		margins, dydx(versionA) post
		parmest, label saving(`tf2', replace) idstr(`dv') level(90) 
restore
preserve
	dsconcat `tf1' 	`tf2'
	keep if parm == "versionA"  
	g dv = "`dv'"
	g group = _n
		lab def group 1 "Catholic" 2 "Evangelical/Pentecostal"
		lab val group group
	save `dv'.dta, replace
restore 
}
preserve
clear
append using $dvs 
sencode dv, replace
	lab def dv 1 "Social Movements" 2 "Legislative Advocacy" 3 "Turnout" 4 "Conscientious Voting" ///
			5 "Candidate Endorsements", modify
	lab val dv dv
sort dv group  
egen yaxis = seq(), f(1) t(2)
graph twoway (bar estimate yaxis if group == 1, lcolor(black) fcolor(gs4) horizontal barwidth(.5)) ///
			(bar estimate yaxis if group == 2, lcolor(black) fcolor(gs12) horizontal barwidth(.5))  ///
			(rspike min90 max90 yaxis, lcolor(black) horizontal), ///
	by(dv, col(1) compact graphregion(fcolor(white) lcolor(black)) ///
		note("Note: Bars represent marginal effects of the membership threat treatment on clergy support for." ///
			"political participation. Sample limited to full questionnaire. Source: Churches North and South 2014," ///
			"Clergy Study. Whiskers represent 95% confidence intervals.", span size(vsmall) margin(small)) ) ///
	subtitle(, ring(0) pos(11) justification(left) nobexpand lwidth(0) lcolor(gs10) fcolor(gs15) margin(vsmall)) ///
	ylabel(none) ytitle("") legend(order(1 "Catholic" 2 "Evangelical/Pentecostal") symxsize(*.5) size(small) col(2)) ///
	ysize(6) xline(0, lcolor(gs5)) xlabel(-.45(.15).45, grid)
restore	
foreach dv in  $dvs {
	rm `dv'.dta
}
************ End FIGURE 5.2. Impact of Membership Threat on Participation


************ Analysis to produce CHAPTER 5, TABLE 2. Determinants of Speech Related to Participation
quietly do "C:\Users\aesmith2\Dropbox\Work\research in progress\book project\Analysis\Setup_clergystudy.do"
global dvs p8_role_socialmovements p11_role_supportlaws p29_campn_encourageturnout p30_campn_faithvote p31_campn_leaders 
global indvars growthoriented difference grievances favored conservatism p10_role_givevoice p27_discuss_respectdifferences p39_ i.denom i.city
eststo clear
foreach dv in  $dvs {
	ologit `dv' $indvars 
	eststo
}
esttab, b(3) nogaps nopar star(* .10 ** .05)
************ End Analysis to produce CHAPTER 5, TABLE 2. Determinants of Speech Related to Participation


************ FIGURE 5.3. Impact of Grievance Threat on Participation
global dvs p8_ p11_role_supportlaws p29_campn_encourageturnout p31_ 
foreach dv in  $dvs {
	preserve
	recode versionA versionB (. = 0)
	recode `dv' (0/.5 = 0) (.6/1 = 1)
	logit `dv' versionC versionA
	margins, dydx(versionC) post
	parmest, label saving(`dv', replace) idstr(`dv') level(90) 
	restore
}
preserve
clear
append using $dvs 
	rename idstr dv
	g yaxis = 5-_n
	sencode dv, replace gsort(yaxis)
		lab def dv 4 "Social Movements" 3 "Legislative Advocacy" 2 "Turnout" 1 "Candidate Endorsements", modify
		lab val dv dv
graph twoway (bar estimate yaxis, lcolor(black) fcolor(gs14) horizontal barwidth(.5)) ///
			(rspike min90 max90 yaxis, lcolor(black) horizontal), ///
		note("Note: Bars represent marginal effects of the grievance treatment on clergy support for political" ///
			"participation. Sample limited to Fortaleza (N = 222)." ///
			"Source: Churches North and South 2014, Clergy Study. Whiskers represent 95% confidence intervals.", span size(small) margin(small)) ///
	ylabel(1 "Candidate Endorsements" 2 "Turnout" 3 "Legislative Advocacy" 4 "Social Movements", angle(horizontal) nogrid) ///
	ytitle("") xtitle("") legend(off) xline(0, lcolor(gs5)) ///
	graphregion(fcolor(white) lcolor(black)) xlabel(0(.2).4, grid)
restore	
foreach dv in  $dvs {
	rm `dv'.dta
}
************ End FIGURE 5.3. Impact of Grievance Threat on Participation

